﻿// <copyright file="Subcatchment.cs" company="City of Portland, BES-ASM">
// </copyright>
// <summary>Subcatchemnt class</summary>

namespace BESASM.EMGAATS.BusinessClasses
{
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;

  /// <summary>
  /// Manages subcatchment data
  /// </summary>
  public class Subcatchment
  {
    private double slopeFtPerFt = 0.0;

    /// <summary>
    /// Gets or sets the name of the subcatchment
    /// </summary>
    public string SubcatchmentName { get; set; }

    /// <summary>
    /// Gets or sets the node to which the subcatchment drains any runoff
    /// </summary>
    public INode Node { get; set; }

    /// <summary>
    /// Gets or sets the area of the subcatchment in square feet
    /// </summary>
    public double AreaSqFt { get; set; }

    /// <summary>
    /// Gets or sets the type of area: <see cref="AreaType"/>
    /// </summary>
    public AreaType AreaType { get; set; }

    /// <summary>
    /// Gets or sets the average slope of the area in ft/ft
    /// </summary>
    public double SlopeFtPerFt
    {
      get
      {
        switch (this.AreaType)
        {
          case AreaType.BLDG:
            return 0.06;

          case AreaType.PRKG:
            return 0.02;

          case AreaType.STRT:
            if (this.slopeFtPerFt <= 0.0)
            {
              return 0.001;
            }
            else
            {
              return this.slopeFtPerFt;
            }

          default:
            throw new NotSupportedException(string.Format("Unsupported area type: {0}", this.AreaType));
        }
      }

      set
      {
        this.slopeFtPerFt = value;
      }
    }

    /// <summary>
    /// Gets or sets the Flow Length of the Subcatchment in feet
    /// </summary>
    public double FlowLengthFt
    {
      get;
      set;
    }
  }
}
